<template>
  <div>
    <home-header :city="city"></home-header>
    <home-swiper :swiper="swiper"></home-swiper>
    <home-icon :iconList="iconList"></home-icon>
  </div>
</template>
<script>
import HomeHeader from './components/homeHeader'
import HomeSwiper from './components/homeSwiper'
import HomeIcon from './components/homeIcon'
import axios from 'axios'
export default {
  name: 'home',
  components: {
    HomeHeader,
    HomeSwiper,
    HomeIcon
  },
  data () {
    return {
      city: '',
      swiper: [],
      iconList: []
    }
  },
  methods: {
    getHomeInfo () {
      axios.get('/api/index.json')
        .then(this.getHomeSucc)
    },
    getHomeSucc (res) {
      res = res.data
      if (res.data) {
        const data = res.data
        this.city = data.city
        this.swiper = data.swiperList
        this.iconList = data.iconList
      }
    }
  },
  mounted () {
    this.getHomeInfo()
  }
}
</script>
<style>
</style>
